🪲 Disable autosave on the code page when viewing a program #6148
+14
−8
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The feature for automatic saving and loading of programs is a bit too aggressive and loads a locally stored program even when we open the code page (/hedy or /tryit) to see a concrete user program. The proposed solution is to turn off the auto-loading when the code page (/hedy or /tryit) requested with a specific program id.
As a summary, if the code page is opened like this /hedy/1, the auto-saving should work as expected. If the code page is opened via /hedy/1/0dc61ace147b46ecbd2c71f1c3fc6c88 (logged as teacher 1), the auto-saving will be disabled. Note that it will be disabled also when moving to other adventure tabs. It will be enabled once we move away from this URL.
Fixes #6043
How to test
print this is autosaved
. Move to another adventure tab, so that this program is saved locally (you should be able to see a message in the console)